<!--
 * @Description:
 * @Date: 2024-04-09 15:56:06
 * @LastEditTime: 2024-11-01 17:50:02
-->
<template>
  <div class="digitization">
    <div class="digitization-header">
      <h1>营业厅数字化平台</h1>
    </div>
    <div class="digitization-content">
      <div class="digitization-content-left">
        <div>
          <div class="dItem-title">
            <span>营业厅设备数</span
            >
          </div>
          <div class="dItem-left1">
            <gridOne :chartData="webInfo.gridOne"></gridOne>
          </div>
        </div>
        <div>
          <div class="dItem-title">
            <span>当月盘查情况</span
            >
          </div>
          <div class="dItem-left2">
             <gridThree :chartData="webInfo.gridOne"></gridThree>
          </div>
        </div>
      </div>
      <div class="digitization-content-center">
        <div>
          <div>
            <p>全市设备总数</p>
            <p>
              <CountTo
                :startVal="0"
                :endVal="webInfo.total"
                :duration="4000"
              /><span>个</span>
            </p>
          </div>
          <div>
            <p>营业厅总数</p>
            <p>
              <CountTo
                :startVal="0"
                :endVal="webInfo.region"
                :duration="4000"
              /><span>个</span>
            </p>
          </div>
          <div>
            <p>已盘查设备(全市)</p>
            <p>
              <CountTo
                :startVal="0"
                :endVal="webInfo.check"
                :duration="4000"
              /><span>个</span>
            </p>
          </div>

        </div>
        <div>
          <!-- <centerMap className="centerMap" @getCount="getCount"></centerMap> -->
          <centerMap className="centerMap" :chartData="webInfo.gridOne"></centerMap>
        </div>
      </div>
      <div class="digitization-content-right">
        <div>
          <div class="dItem-title">
            <span>设备类型</span
            >
          </div>
          <div class="dItem-right1">
             <gridTwo :chartData=webInfo.gridTwo></gridTwo>
          </div>
        </div>
        <div>
          <div class="dItem-title">
            <span>完成率排名</span
            >
          </div>
          <div class="dItem-left2">
             <gridFour :chartData=webInfo.gridOne></gridFour>
          </div>
        </div>
      </div>
    </div>
    <div
      class="skipHou"
      @click="
        () => {

          this.$router.push('/equipmentTableList');
        }
      "
    >
      <img src="../../assets/images/back.png" />
      <p>后台管理</p>
    </div>
  </div>
</template>

<script>
import CountTo from "vue-count-to";
import gridOne from "./components/home/gridOne.vue";
import gridTwo from "./components/home/gridTwo.vue";
import gridThree from "./components/home/gridThree.vue";
import gridFour from "./components/home/gridFour.vue";
import centerMap from "./components/centerMap.vue";
import autofit from "autofit.js";
import EquipmentTableApi from "../../modules/equipmentTable/api/equipmentTable"
export default {
  components: {
    gridOne,
    gridThree,
    gridTwo,
    centerMap,
    CountTo,
    gridFour
  },
  data() {
    return {
       webInfo:{
         gridOne:[],
         gridTwo:[]
       }
    };
  },
  created() {
    EquipmentTableApi.getStatistics().then(res=>{
      if(res.data.code ==200){
        this.webInfo = Object.assign({}, res.data.data)
      }
    })
  },
  mounted() {
    autofit.init({
      dh: 1080,
      dw: 1920,
      el: ".digitization",
      resize: true,
    });
  },
  methods: {
    handleSkip(path) {
      this.$messageBox.hide();
      this.$router.push({ path });
    },
    getCount(value) {
      this.numberCount.lianLuoCount = value && value;
    },
    getNumber(rows) {
      return rows.length > 0
        ? rows.reduce(
            (accumulator, currentValue) =>
              accumulator + Number(currentValue.count),
            0
          )
        : 0;
    },
  },
};
</script>
<style lang="scss" scoped>
.digitization {
  width: 100%;
  height: 100%;
  background: #021132;
  display: flex;
  flex-direction: column;

  &-header {
    width: 100%;
    height: 100px;
    background-image: url("../../assets/images/digitzation/top.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    h1 {
      margin-top: 10px;
      font-weight: bold;
      letter-spacing: 5px;
      color: #fff;
    }
  }
  &-content {
    width: 100%;
    flex: 1;
    padding: 0 30px 10px 30px;
    margin-top: 30px;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    &-left,
    &-right {
      width: 28%;
      height: 100%;
      display: grid;
      grid-template-columns: 1fr;
      grid-template-rows: repeat(2, 1fr);
      grid-gap: 30px;
      & > div {
        background: yellow;
        background: url("../../assets/images/digitzation/frame.png") no-repeat;
        background-size: 100% 100%;
        padding: 15px 20px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        .dItem-title {
          line-height: 40px;
          margin-left: 10px;
          color: #fff;
          font-weight: bold;
          font-size: 18px;
          display: flex;
          justify-content: space-between;
        }
        .dItem-left1 {
          width: 100%;
          flex: 1;
          display: flex;

          & > div:nth-child(1) {
            width: 30%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            & > div {
              display: flex;
              flex-direction: column;
              align-items: center;
              color: #fff;
              & > p:nth-child(1) {
                font-size: 16px;
                margin-bottom: 15px;
              }
              & > p:nth-child(2) {
                font-size: 22px;
                font-weight: bold;
              }
            }
            & > div:nth-child(1) {
              margin-bottom: 30px;
            }
          }
          & > div:nth-child(2) {
            height: 100%;
            flex: 1;
          }
        }
        .dItem-left2 {
          width: 100%;
          flex: 1;
          display: flex;
          & > div:nth-child(1) {
            width: 30%;
            margin-right: 2%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            & > div:nth-child(1) {
              color: #fff;
              display: flex;
              flex-direction: column;
              align-items: center;
              & > p:nth-child(1) {
                font-size: 16px;
                margin-bottom: 15px;
              }
              & > p:nth-child(2) {
                font-size: 22px;
                font-weight: bold;
              }
            }
            & > div:nth-child(2) {
              display: flex;
              justify-content: space-between;
              margin-top: 40px;
              color: #fff;
              & > div {
                color: #fff;
                & > p:nth-child(1) {
                  font-size: 16px;
                  margin-bottom: 15px;
                }
                & > p:nth-child(2) {
                  font-size: 22px;
                  font-weight: bold;
                }
              }
            }
          }
          & > div:nth-child(2) {
            height: 100%;
            flex: 1;
          }
        }
        .dItem-right1 {
          width: 100%;
          flex: 1;
          display: flex;
          flex-direction: column;
          overflow: hidden;

          & > div:nth-child(1) {
            width: 100%;
            height: 100%;
            color: #fff;
            margin-top: 10px;

            box-sizing: border-box;
            & > div {
              display: flex;
              align-items: center;
              & > span:nth-child(1) {
                font-size: 16px;
              }
              & > span:nth-child(2) {
                flex: 1;
                white-space: nowrap;
                overflow: hidden;
              }
              & > span:nth-child(3) {
                font-size: 24px;
              }
            }
          }
          & > div:nth-child(2) {
            width: 100%;
            flex: 1;
            overflow: hidden;
          }
        }
      }
    }
    &-center {
      height: 100%;
      flex: 1;
      margin: 0 10px;
      display: flex;
      flex-direction: column;
      & > div:nth-child(1) {
        width: 100%;
        height: 150px;
        margin-bottom: 20px;
        background: url("../../assets/images/digitzation/center1.png") no-repeat;
        background-size: 100% 100%;
        padding: 15px 20px;
        box-sizing: border-box;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: 1fr;
        grid-gap: 10px;
        & > div {
          color: #fff;
          display: flex;
          flex-direction: column;
          justify-content: space-evenly;
          align-items: center;
          & > p:nth-child(1) {
            font-size: 20px;
          }
          & > p:nth-child(2) {
            span:nth-child(1) {
              font-size: 30px;
              font-weight: bold;
            }
            span:nth-child(2) {
              font-size: 16px;
              font-weight: bold;
            }
          }
        }
      }
      & > div:nth-child(2) {
        width: 100%;
        flex: 1;
        background: url("../../assets/images/digitzation/center2.png") no-repeat;
        background-size: 100% 100%;
        padding: 15px 20px;
      }
    }
  }
  .skipHou {
    position: absolute;
    top: 70px;
    right: 50px;
    display: flex;
    justify-content: center;
    align-items: center;

    color: #fff;
    font-size: 18px;
    font-weight: bold;
    img {
      width: 30px;
      margin-right: 10px;
    }
  }
}


</style>
